x86/AMD: Load context when attempting to read VPMU MSRs
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Mon, 15 Apr 2013 09:24:52 +0000 (11:24 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 15 Apr 2013 09:24:52 +0000 (11:24 +0200)
commit176706746dee6ad72f6bf15d2b6093973c652d6b
tree23874aec42dbaf438b4fa1dc9ce8dc3d9c21242a
parent45773c5fb6346b1bc2a2ddcc6d19bd7f53ccabff
x86/AMD: Load context when attempting to read VPMU MSRs

Load context (and mark it as LOADED) on any MSR access. This will allow
us to always read the most up-to-date value of an MSR: guest may write
into an MSR without enabling it (thus not marking the context as RUNNING)
and then be migrated. Without first loading the context reading this MSR
from HW will not match the pervious write since registers will not be
loaded into HW in amd_vpmu_load().

In addition, we should be saving the context when it is LOADED, not
RUNNING --- otherwise we need to save it any time it becomes non-RUNNING,
which may be a frequent occurrence.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
xen/arch/x86/hvm/svm/vpmu.c